﻿namespace FrameworkCore.Models;

public class PageResult<T> : Result where T : class
{
    /// <summary>
    /// 当前页
    /// </summary>
    public int Current { get; set; }

    /// <summary>
    /// 每页大小
    /// </summary>
    public int PageSize { get; set; }

    /// <summary>
    /// 总条数
    /// </summary>
    public int Total { get; set; }

    /// <summary>
    /// 总页数
    /// </summary>
    public int TotalPages { get; set; }

    /// <summary>
    /// 有上一页
    /// </summary>
    public bool HasPreviousPage => Current > 1;

    /// <summary>
    /// 有下一页
    /// </summary>
    public bool HasNextPage => Current < TotalPages;

    /// <summary>
    /// 返回数据
    /// </summary>
    public IEnumerable<T> Data { get; set; }
}
